<template>
  <div>
    <el-input v-model="state.form.name" placeholder="请输入name" />
    <el-input v-model="state.form.password" placeholder="password" />
    <el-button type="danger" @click="login">登录</el-button>
    <div>code：{{ code }}</div>
    <div>name：{{ name }}</div>
    <el-button type="danger" @click="setUserInfo">更新</el-button>
  </div>
</template>

<script lang="ts" setup>
import { ref, reactive } from "vue";
import { storeToRefs } from "pinia";
import { useUserStore } from "@/store/userInfo";
import { useAuthLoginApi, useAuthNavMenuApi } from "@/api/login/auth";
const countStore = useUserStore();
const { code, name } = storeToRefs(countStore);
const state = reactive({
  form: {
    name: '',
    password: ''
  }
})
const login = async () => {
  let { token } = await useAuthLoginApi(state.form)
  let { content } = await useAuthNavMenuApi()

  console.log(content);
  
};

const setUserInfo = () => {
  countStore.setUserInfo("123456", "user");
};
</script>
